package com.vg.spinner;

import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;

import com.androidhive.jsonparsing.R;

import android.R.layout;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ListViewAdapter_gender extends BaseAdapter {
	 private Activity activity;
	static ImageView image;
	static View vi;
	Context Context;
//	 private Map<ImageView, String> imageViews=Collections.synchronizedMap(new WeakHashMap<ImageView, String>());
	    private ArrayList<String> data;
	    private static LayoutInflater inflater=null;
	    
		    
	    public ListViewAdapter_gender(Activity a, ArrayList<String> d) {
	        activity = a;
	        data=d;
	        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	    }
	    
		public ListViewAdapter_gender(Context context, ArrayList<String> d) {
			Context = context;
			inflater = LayoutInflater.from(context);
			data = d;

		}

//	    public ListViewAdapter(Activity activity,
//				ArrayList<HashMap<String, String>> data) {
//			super();
//			this.activity = activity;
//			this.data = data;
//			inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//			imageLoader=new ImageLoader(activity.getApplicationContext());
//			
//		}


		public int getCount() {
	        return data.size();
	    }

	    public Object getItem(int position) {
	        return position;
	    }

	    public long getItemId(int position) {
	        return position;
	    }
	  
	      
	    public View getView(int position, View convertView, ViewGroup parent) {
	              vi=convertView;
	        if(convertView==null)
	        vi = inflater.inflate(R.layout.gender_action_item_vertical, null);
//	        TextView content= (TextView)vi.findViewById(R.id.tvcontent);
	        TextView gender = (TextView)vi.findViewById(R.id.tv_gender1);
//	        TextView title = (TextView)vi.findViewById(R.id.tvtitle);
//	        image=(ImageView)vi.findViewById(R.id.list_image);
	        
	        
	        // title
	        
	        String _id =new String();
	        _id = data.get(position);

	        gender.setText(_id);
	        //Setting all values in listview
	       
//	        content.setText(_id.get("messageID"));
	   //     date.setText(_id.get("time"));
	     //   title.setText(_id.get("title"));
	    //    imageLoader.DisplayImage(_id.get(AndroidJSONParsingActivity.TAG_PICTURE), image);
	      //  image.setBackgroundDrawable(LoadImageFromWeb(_id.get(AndroidJSONParsingActivity.TAG_PICTURE)));
	        
	        return vi;
	    }
}
